/**
 * 
 */
package com.zznode.client.wlanpolling.model;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.zznode.client.wlanpolling.R;

/**
 * 
 *
 */
public class APInfo extends GeneralInfo{
	
	public String DEV_ID;
	public String AP_CODE;
	public String AP_IP;
	public String AP_MAC;
	public String AP_SN;
	public String AP_LEVEL;
	public String AP_LONGTITUDE;
	public String AP_LATITUDE;
//	public String AP_TRANSFER_TYPE;
	public String AP_COVER_TYPE;
	public String AP_COVER;
	public String AP_AREAID;
	public String AP_COMPANY;
	public String AP_ALIAS;
	public String AP_CONTRACTPERSON;
	public String AP_CONTRACTFUNC;
	public String AP_RUNTIME;
	public String AP_GATEWAY_ADDRESS;
	public String AP_SECTION_NO1;
	public String AP_SECTION_NO2;
	public String AP_VLAN_ID;
	public String AP_SOFT_VERSION;
	public String AP_DEV_POSITION;
	public String AP_REMARK;
	
	public double REAL_LNG, REAL_LAT;
	
	@Override
	public String getGroupName() {
		return "AP信息：";
	}
	@Override
	public int getLayoutID() {
		return R.layout.apinfo;
	}
	
	@Override
	public int getRootID() {
		return R.id.apinfo;
	}
	@Override
	public void bind(View root) {
		TextView tv = null;
		EditText et = null;
		Button btn = null;
		
		tv = (TextView)root.findViewById(R.id.ap_id);
		tv.setText(AP_CODE);
		tv = (TextView)root.findViewById(R.id.ap_ip);
		tv.setText(AP_IP);
		tv = (TextView)root.findViewById(R.id.ap_mac);
		tv.setText(AP_MAC);
		tv = (TextView)root.findViewById(R.id.ap_sn);
		tv.setText(AP_SN);
		
		final EditText et2 = (EditText)root.findViewById(R.id.ap_lng);
		et2.setText(AP_LONGTITUDE);
		addTextChangeListener(et2, "AP_LONGTITUDE");
		btn = (Button)root.findViewById(R.id.ap_replacelng);
		btn.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				et2.setText("" + REAL_LNG);
			}
			
		});
		
		tv = (TextView)root.findViewById(R.id.ap_reallng);
		tv.setText("" + REAL_LNG);
		final EditText et3 = (EditText)root.findViewById(R.id.ap_lat);
		et3.setText(AP_LATITUDE);
		addTextChangeListener(et3, "AP_LATITUDE");
		btn = (Button)root.findViewById(R.id.ap_replacelat);
		btn.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				et3.setText("" + REAL_LAT);
			}
			
		});
		tv = (TextView)root.findViewById(R.id.ap_reallat);
		tv.setText("" + REAL_LAT);
		
		tv = (TextView)root.findViewById(R.id.ap_level);
		tv.setText(AP_LEVEL);
		et = (EditText)root.findViewById(R.id.ap_vlan);
		et.setText(AP_VLAN_ID);
		addTextChangeListener(et, "AP_VLAN_ID");
		tv = (TextView)root.findViewById(R.id.ap_covertype);
		tv.setText(AP_COVER_TYPE);
		tv = (TextView)root.findViewById(R.id.ap_version);
		tv.setText(AP_SOFT_VERSION);
		et = (EditText)root.findViewById(R.id.ap_location);
		et.setText(AP_DEV_POSITION);
		addTextChangeListener(et, "AP_DEV_POSITION");
		et = (EditText)root.findViewById(R.id.ap_coverarea);
		et.setText(AP_COVER);
		addTextChangeListener(et, "AP_COVER");
		et = (EditText)root.findViewById(R.id.ap_contact);
		et.setText(AP_CONTRACTPERSON);
		addTextChangeListener(et, "AP_CONTRACTPERSON");
		et = (EditText)root.findViewById(R.id.ap_contactinfo);
		et.setText(AP_CONTRACTFUNC);
		addTextChangeListener(et, "AP_CONTRACTFUNC");
		tv = (TextView)root.findViewById(R.id.ap_relating1);
		tv.setText(AP_SECTION_NO1);
		tv = (TextView)root.findViewById(R.id.ap_relating2);
		tv.setText(AP_SECTION_NO2);
		tv = (TextView)root.findViewById(R.id.ap_workingperiod);
		tv.setText(AP_RUNTIME);
		
		//增加备注
		tv =(TextView)root.findViewById(R.id.ap_remark);
		tv.setText(AP_REMARK);
	}	
}
